package com.zecan.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @ClassName NacosConsumerController
 * @Description TODO
 * @date 2022/5/10 20:03
 * @Version 1.0
 */
@RestController
public class NacosConsumerController {

    @Resource
    private RestTemplate restTemplate;

    @Value(value = "${service-url.nacos-user-service}")
    private String serviceUrl;


    @RequestMapping(value = "/consumer/nacos/{id}")
    public String getNacosProviderMsg(@PathVariable("id") Integer id) {
        return restTemplate.getForObject(serviceUrl + "/payment/nacos/" + id, String.class);
    }

}
